function  save() {
    var params = {};
    params['name']=$("#proName").val();
    params['tags']=$("#proTags").val();
    params['placecounts']=Number($("#placeCounts").val());

    console.log(params)
    jQuery.post('/proSave',params,function (res) {
        console.log(res);
        if (res.hasOwnProperty("msg1")){
            alert("省份已存在！");
        }else if (res.hasOwnProperty("msg2")){
            alert("请完善省份信息....");
        } else {
            console.log(params);
            jQuery.post('/proSave',params,function (res) {
                console.log(res);
                $("#addPro").modal('hide');
                window.location.reload();
            },"json");
        }

    },"json");

}

function deletePro(id) {
    console.log(id);
    var params = {};
    params['id']=id;
    $.post('/proDelete',params,function (res) {
        window.location.reload();
    },"json");
}


function editPro(pro) {
    console.log(pro);
    $("#proId1").val(pro.id);
    $("#proName1").val(pro.name);
    $("#proTags1").val(pro.tags);
    $("#placeCounts1").val(pro.placecounts+"");

    $("#updatePro").modal('show');
}

function  save1() {
    var params = {};
    params['id']=$("#proId1").val();
    params['name']=$("#proName1").val();
    params['tags']=$("#proTags1").val();
    params['placecounts']=$("#placeCounts1").val();

    jQuery.post('/proUpdate',params,function (res) {
        console.log(res);
        if (res.hasOwnProperty("msg2")){
            alert("请完善信息....");
        } else {
            console.log(params);
            jQuery.post('/proUpdate',params,function (res) {
                console.log(res);
                $("#updatePro").modal('hide');
                window.location.reload();
            },"json");
        }

    },"json");
}


//查询景点时获取省份id
function selectPro(id) {
    console.log(id);
    var params = {};
    params['id']=id;
    $.post('/proSelect',params,function (res) {
        console.log(res);
    },"json");
}


